/***************************************************************************
 *   Copyright (C) 2005 by ywchen2000                                *
 *   ywchen2000@yahoo.com.cn                                                          *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#include<iostream>
template<class T>
class node
{
 private:
     node<T> *next;  	 
 public:
     T data; 
     node(void);
     node(T data1,node<T> *p=NULL);
    ~node(void); 
void insertafter(node<T> *p);
void insert(node<T>* p);
void deleteafter(void);
node<T>* nextnode(void);
};
template<class T>
node<T>::node(void)
{
    next=NULL;
}
template<class T>
node<T>::node(T data1,node<T> *p)
{
   data=data1;
   next=p;
}
template<class T>
void node<T>::insertafter(node<T> *p)
{
       p->next=next;
       next=p;
}
template<class T>
void node<T>::deleteafter(void)
{
      node<T> *temp;
      temp=next;
      next=temp->next;
      delete temp;
}
template<class T>
node<T>* node<T>::nextnode(void)
{
	return next;
}
template<class T>
node<T>::~node(void)
{}
template<class T>
void node<T>::insert(node<T>* p)
{
      next=p;
}

